package org.cloudie.docs.editor.client.content.contextmenus;

import org.cloudie.docs.editor.client.commands.generic.VirtualEntryFolderEmptyCommand;
import org.cloudie.docs.editor.client.events.CommandEvent;
import org.cloudie.docs.editor.client.resources.icons.IconsHelper;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;


public class TrashIconContextMenu extends IconContextMenu {

  protected static TrashIconContextMenu instance;
  
  public static TrashIconContextMenu get() {
    if (instance == null) {
      instance = new TrashIconContextMenu();
    }
    return instance;
  }
  
  protected TrashIconContextMenu() {
	this.removeItem(this.getItems().get(2));
	this.removeItem(this.getItems().get(1));
	addMenuItem(IconsHelper.icons.Blank(), "Empty trash bin", new Command() {
	    @Override
		public void execute() {
	      if (target != null) {
	    	boolean c = Window.confirm("The trash bin will be emptied.");
	    	if (c) {
	      	  CommandEvent.fire(new VirtualEntryFolderEmptyCommand(target.getId()));
	    	}
	      }
		}
	});
  }

}
